import React, { useState } from 'react';

import DRoot from './DRoot';
import DGrid from './DGrid';
import DRow from './DRow';
import DCol from './DCol';

import DInputField from './DInputField';
import DDatePickerField from './DDatePickerField';

import DTitle from './DTitle';
import DFormula from './DFormula';


import DInput from './DInput';
import DDatePicker from './DDatePicker';


import DScoreCard from './DScoreCard';
import DScoreSelect from './DScoreSelect';
import DScoreInput from './DScoreInput';

const DComponent = (props) => {

    const { node } = props;

    let result = <></>;

    switch (node.type) {

        case 'root':
            result = <DRoot {...props} />
            break;
        case 'grid':
            result = <DGrid {...props} />
            break;
        case 'row':
            result = <DRow {...props} />
            break;
        case 'col':
            result = <DCol  {...props} />
            break;
        case 'input-field':
            result = <DInputField {...props} />
            break;
        case 'datePicker-field':
            result = <DDatePickerField {...props} />
            break;
        case 'title':
            result = <DTitle {...props} />
            break;
        case 'formula':
            result = <DFormula {...props} />
            break;
        case 'input':
            result = <DInput {...props} />
            break;
        case 'datepicker':
            result = <DDatePicker {...props} />
            break;
        case 'score-card':
            result = <DScoreCard {...props} />
            break;
        case 'score-select':
            result = <DScoreSelect {...props} />
            break;
        case 'score-input':
            result = <DScoreInput {...props} />
            break;
        default:
            break;

    }

    return result;

}


export default DComponent;